//
//  ComingMovieTableViewCell.m
//  A段项目
//
//  Created by ～whc on 15-6-19.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ComingMovieTableViewCell.h"

@implementation ComingMovieTableViewCell
- (void)dealloc
{
    [self.title release];
    [self.image release];
    [self.releaseDate release];
    [self.wantedCount release];
    [self.director release];
    [self.actor release];
    [self.typeLabel release];
    
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        if (WIDTH == 320 && HEIGHT == 568) {
            [self creatTable5];
        }
        if (WIDTH == 414 && HEIGHT == 736) {
            [self creatTablePlus];
        }
        if (WIDTH == 375 && HEIGHT == 667){
            [self creatTable6];
        }

    }
    return self;
}

-(void)creatTable5
{
  
    self.releaseDate = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 100, 30)];
    self.releaseDate.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.releaseDate];
    [_releaseDate release];
    
    self.image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 100, 150)];
    self.image.layer.shadowOpacity = 0.9;
    self.image.layer.shadowOffset = CGSizeMake(0, 3);
    self.image.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    self.image.layer.shadowRadius = 15;
    [self.contentView addSubview:self.image];
    [_image release];
    
    self.title = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x+self.image.frame.size.width+ 10, self.image.frame.origin.y, 200, 30)];
    self.title.font = [UIFont boldSystemFontOfSize:16];
    [self.contentView addSubview:self.title];
    [_title release];
    
    self.wantedCount = [[UILabel alloc]initWithFrame:CGRectMake(self.title.frame.origin.x, self.title.frame.origin.y+self.title.frame.size.height+10, 180, 30)];
//    self.wantedCount.backgroundColor = [UIColor redColor];
    self.wantedCount.textColor = [UIColor orangeColor];
    [self.contentView addSubview:self.wantedCount];
    [_wantedCount release];
    
    
//    self.typeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.wantedCount.frame.origin.x + self.wantedCount.frame.size.width, self.wantedCount.frame.origin.y, 125, 30)];
//    self.typeLabel.textColor = [UIColor lightGrayColor];
//    self.typeLabel.font = [UIFont boldSystemFontOfSize:17];
    //    [self.typeLabel setBackgroundColor:[UIColor redColor]];
//    [self.contentView addSubview:self.typeLabel];
    
    self.director = [[UILabel alloc]initWithFrame:CGRectMake(self.wantedCount.frame.origin.x, self.wantedCount.frame.origin.y+45, 100, 30)];
    self.director.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.director];
    [_director release];
    
    
    
    self.actor = [[UILabel alloc]initWithFrame:CGRectMake(self.director.frame.origin.x, self.director.frame.origin.y+30,150 , 30)];
    self.actor.textColor  = [UIColor lightGrayColor];
    [self.contentView addSubview:self.actor];
    [_actor release];
    
    UILabel *Buttonlabel = [[UILabel alloc] initWithFrame:CGRectMake(self.director.frame.origin.x+self.director.frame.size.width, self.director.frame.origin.y, 80, 30)];
    Buttonlabel.layer.cornerRadius = 15;
    //    Buttonlabel.layer.borderWidth = 1;
    Buttonlabel.text = @"预告片";
    Buttonlabel.textColor = [UIColor blueColor];
    Buttonlabel.textAlignment = NSTextAlignmentCenter;
    //    Buttonlabel.layer.backgroundColor = [UIColor blueColor].CGColor;
    [self.contentView addSubview:Buttonlabel];
    
    
    
}


-(void)creatTable6
{
   
    
    
    self.releaseDate = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 100, 30)];
    self.releaseDate.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.releaseDate];
    [_releaseDate release];
    
    self.image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 100, 150)];
    self.image.layer.shadowOpacity = 0.9;
    self.image.layer.shadowOffset = CGSizeMake(0, 3);
    self.image.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    self.image.layer.shadowRadius = 15;
    [self.contentView addSubview:self.image];
    [_image release];
    
    self.title = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x+self.image.frame.size.width+20, self.image.frame.origin.y, 200, 30)];
    self.title.font = [UIFont boldSystemFontOfSize:18];
    [self.contentView addSubview:self.title];
    [_title release];
    
    self.wantedCount = [[UILabel alloc]initWithFrame:CGRectMake(self.title.frame.origin.x, self.title.frame.origin.y+self.title.frame.size.height+10, 220, 30)];
    self.wantedCount.textColor = [UIColor orangeColor];
//    self.wantedCount.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.wantedCount];
    [_wantedCount release];

    
//    self.typeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.wantedCount.frame.origin.x + self.wantedCount.frame.size.width, self.wantedCount.frame.origin.y, 125, 30)];
//    self.typeLabel.textColor = [UIColor lightGrayColor];
//    self.typeLabel.font = [UIFont boldSystemFontOfSize:17];
////    [self.typeLabel setBackgroundColor:[UIColor redColor]];
//    [self.contentView addSubview:self.typeLabel];
    
    self.director = [[UILabel alloc]initWithFrame:CGRectMake(self.wantedCount.frame.origin.x, self.wantedCount.frame.origin.y+30, 150, 30)];
    self.director.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.director];
    [_director release];
    
    
    
    self.actor = [[UILabel alloc]initWithFrame:CGRectMake(self.director.frame.origin.x, self.director.frame.origin.y+30,150 , 30)];
    self.actor.textColor  = [UIColor lightGrayColor];
    [self.contentView addSubview:self.actor];
    [_actor release];
    
    UILabel *Buttonlabel = [[UILabel alloc] initWithFrame:CGRectMake(self.director.frame.origin.x+self.director.frame.size.width, self.director.frame.origin.y, 80, 30)];
    Buttonlabel.layer.cornerRadius = 15;
//    Buttonlabel.layer.borderWidth = 1;
    Buttonlabel.text = @"预告片";
    Buttonlabel.textColor = [UIColor blueColor];
    Buttonlabel.textAlignment = NSTextAlignmentCenter;
//    Buttonlabel.layer.backgroundColor = [UIColor blueColor].CGColor;
    [self.contentView addSubview:Buttonlabel];
    


}

-(void)creatTablePlus
{
    
    self.releaseDate = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 100, 30)];
    self.releaseDate.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.releaseDate];
    [_releaseDate release];
    
    self.image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 100, 150)];
    self.image.layer.shadowOpacity = 0.9;
    self.image.layer.shadowOffset = CGSizeMake(0, 3);
    self.image.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    self.image.layer.shadowRadius = 15;
    [self.contentView addSubview:self.image];
    [_image release];
    
    self.title = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x+self.image.frame.size.width+25, self.image.frame.origin.y, 200, 30)];
    self.title.font = [UIFont boldSystemFontOfSize:20];
    [self.contentView addSubview:self.title];
    [_title release];
    
    self.wantedCount = [[UILabel alloc]initWithFrame:CGRectMake(self.title.frame.origin.x, self.title.frame.origin.y+self.title.frame.size.height+10, 250, 30)];
//    [self.wantedCount setBackgroundColor:[UIColor redColor]];
    self.wantedCount.textColor = [UIColor orangeColor];
    [self.contentView addSubview:self.wantedCount];
    [_wantedCount release];
    
    
//    self.typeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.wantedCount.frame.origin.x + self.wantedCount.frame.size.width, self.wantedCount.frame.origin.y, 150, 30)];
//    self.typeLabel.textColor = [UIColor lightGrayColor];
//    self.typeLabel.font = [UIFont boldSystemFontOfSize:17];
//    //    [self.typeLabel setBackgroundColor:[UIColor redColor]];
//    [self.contentView addSubview:self.typeLabel];
    
    self.director = [[UILabel alloc]initWithFrame:CGRectMake(self.wantedCount.frame.origin.x, self.wantedCount.frame.origin.y+35, 150, 30)];
    self.director.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.director];
    [_director release];
    
    
    
    self.actor = [[UILabel alloc]initWithFrame:CGRectMake(self.director.frame.origin.x, self.director.frame.origin.y+35,150 , 30)];
    self.actor.textColor  = [UIColor lightGrayColor];
    [self.contentView addSubview:self.actor];
    [_actor release];
    
    UILabel *Buttonlabel = [[UILabel alloc] initWithFrame:CGRectMake(self.director.frame.origin.x+self.director.frame.size.width+30, self.director.frame.origin.y, 80, 30)];
    Buttonlabel.layer.cornerRadius = 15;
    //    Buttonlabel.layer.borderWidth = 1;
    Buttonlabel.text = @"预告片";
    Buttonlabel.textColor = [UIColor blueColor];
    Buttonlabel.textAlignment = NSTextAlignmentCenter;
    //    Buttonlabel.layer.backgroundColor = [UIColor blueColor].CGColor;
    [self.contentView addSubview:Buttonlabel];
    
    
    
}
-(void)setCom:(Coming *)com
{
    if (_com != com) {
        [_com release];
        _com = [com retain];
    }
    self.title.text = com.title;
    self.releaseDate.text = com.releaseDate;
    NSString *str = com.director;
    self.director.text = [NSString stringWithFormat:@"导演:%@",str];
    NSString *str1 = com.actor1;
    NSString *str2 = com.actor2;
    NSString *type = [NSString stringWithFormat:@" - %@", com.type];
//    NSLog(@"type= %@", com.type);
    self.actor.text = [NSString stringWithFormat:@"演员:%@,%@",str1,str2];
    NSURL *url = [NSURL URLWithString:com.image];
    [self.image sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"111111.png"]];
    self.wantedCount.text = [NSString stringWithFormat:@"%ld人想看%@",(long)com.wantedCount, type];


}









- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
